﻿"use strict"

function addModalWallet() {

}

function GetIconUrl(provider, icon) {
  return "gameicon/" + provider + "/" + icon + ".png"
}


function runes_insert(parent, Runes, Number, __ID, time, onclickitem) {
  // background-color: rgb(0, 0, 0);
  var innerHTML = '\
          <div class="col-6 col-md-3 col-xl-2 mb-3 bg-transparent">\
          <div class="runes-item-container" style="min-width: 177px;">\
            <div class="d-flex  flex-column justify-content-center align-items-center"\
              style="height: 210px; min-width: 177px; background-color: rgb(83, 83, 83); color: rgb(231, 231, 231);">\
              <div class="sg-font rune-content p-3 break-all">\
              __Runes</div>\
            </div>\
            <div class="p-2" style="height: 72px; color: rgb(255, 255, 255);">\
              <div class="d-flex flex-row justify-content-between mb-3">\
                <div class="sg-font">#__Number</div>\
                <div class="sg-font hash text-overflow">\
                __ID</div>\
              </div>\
              <div class="d-flex justify-content-between">\
                <div class="sg-font" style="font-size: 10px;">__time</div>\
                <div class="font" style="font-size: 14px;"></div>\
              </div>\
            </div>\
          </div>\
        </div>\
        ';

  innerHTML = innerHTML.replace(/__Runes/g, Runes);
  innerHTML = innerHTML.replace(/__Number/g, Number);
  innerHTML = innerHTML.replace(/__ID/g, __ID);
  innerHTML = innerHTML.replace(/__time/g, time);

  var item_new = document.createElement("div");
  item_new.innerHTML = innerHTML;
  parent.appendChild(item_new.children[0]);
}

function NFT_insert(parent, imgSrc, href) {
  let innerHTML = '\
    <a href="_href" class="col-6 col-md-3 col-xl-2 mb-3 bg-transparent" style="position: relative;">\
    <div class="runes-item-container" style="min-width: 177px;height:282px">\
      <div class="d-flex  flex-column justify-content-center align-items-center"\
        style="height: 210px; min-width: 177px; background-color: var(--black-1); color: rgb(231, 231, 231);">\
        <div style="width:100%;height:100%;position: relative;">\
          <img src="_imgSrc/bg.jpg" width="100%" />\
        </div>\
      </div>\
    </div>\
    <img src="_imgSrc/dragon.png"  class="hoverBiggger-3" />\
    <img src="_imgSrc/font.png" class="NFT-Font"/>\
  </a>\
        ';
  innerHTML = innerHTML.replace(/_imgSrc/g, imgSrc);
  innerHTML = innerHTML.replace(/_href/g, href);
  var item_new = document.createElement("div");
  item_new.innerHTML = innerHTML;
  parent.appendChild(item_new.children[0]);
}

function onclickitem(ii, gameID) {



}

function onclick_brand_logo() {
  if (window.innerWidth < 992) {
    $('.nav-control').click();
  }
  else {
    window.location.href = "index.html" + window.location.search;
  }
}

function ShowToastr(title, content) {
  toastr.success(content, title, {
    positionClass: "toast-top-center",
    timeOut: 5e3,
    closeButton: !0,
    debug: !1,
    newestOnTop: !0,
    progressBar: !0,
    preventDuplicates: !0,
    onclick: null,
    showDuration: "300",
    hideDuration: "1000",
    extendedTimeOut: "1000",
    showEasing: "swing",
    hideEasing: "linear",
    showMethod: "fadeIn",
    hideMethod: "fadeOut",
    tapToDismiss: !1
  })
}

function ShowToastrError(title, content) {
  toastr.error(content, title, {
    positionClass: "toast-top-center",
    timeOut: 5e3,
    closeButton: !0,
    debug: !1,
    newestOnTop: !0,
    progressBar: !0,
    preventDuplicates: !0,
    onclick: null,
    showDuration: "300",
    hideDuration: "1000",
    extendedTimeOut: "1000",
    showEasing: "swing",
    hideEasing: "linear",
    showMethod: "fadeIn",
    hideMethod: "fadeOut",
    tapToDismiss: !1
  })
}


function getLastTime(time) {
  var nTime = new Date(time); //截止时间
  var eTime = new Date();
  var t = eTime.getTime() - nTime.getTime();
  console.log(eTime.getTime(), nTime.getTime());
  var d = Math.floor(t / 1000 / 60 / 60 / 24);
  var h = Math.floor(t / 1000 / 60 / 60 % 24);
  var m = Math.floor(t / 1000 / 60 % 60);
  var s = Math.floor(t / 1000 % 60);
  let GMT = d + ' Day ' + h + ':' + m + ':' + s;
  GMT = GMT.replace(/0:/g, "").replace(/0 Day /g, "").replace(/-/g, "");
  return GMT;
}


function getDateDiff(dateTimeStamp) {
  var minute = 1000 * 60;
  var hour = minute * 60;
  var day = hour * 24;
  var halfamonth = day * 15;
  var month = day * 30;
  var now = new Date().getTime();
  var diffValue = now - dateTimeStamp;
  if (diffValue < 0) { return; }
  var monthC = diffValue / month;
  var weekC = diffValue / (7 * day);
  var dayC = diffValue / day;
  var hourC = diffValue / hour;
  var minC = diffValue / minute;
  var result;
  if (monthC >= 1) {
    result = "" + parseInt(monthC) + " month ago";
  }
  else if (weekC >= 1) {
    result = "" + parseInt(weekC) + " week ago";
  }
  else if (dayC >= 1) {
    result = "" + parseInt(dayC) + " day ago";
  }
  else if (hourC >= 1) {
    result = "" + parseInt(hourC) + " hour ago";
  }
  else if (minC >= 1) {
    result = "" + parseInt(minC) + " minutes ago";
  } else {
    result = "" + parseInt(diffValue / 1000) + " second ago";
  }
  return result;
}

let onComingsoon_ii = 0
function onComingsoon() {
  if (onComingsoon_ii % 2 == 1) {
    toastr.info("Coming soon.", "", {
      positionClass: "toast-top-center",
      timeOut: 5e3,
      closeButton: !0,
      debug: !1,
      newestOnTop: !0,
      progressBar: !0,
      preventDuplicates: !0,
      onclick: null,
      showDuration: "300",
      hideDuration: "1000",
      extendedTimeOut: "1000",
      showEasing: "swing",
      hideEasing: "linear",
      showMethod: "fadeIn",
      hideMethod: "fadeOut",
      tapToDismiss: !1
    })
  }
  else {
    toastr.error("Coming soon..", "", {
      positionClass: "toast-top-center",
      timeOut: 5e3,
      closeButton: !0,
      debug: !1,
      newestOnTop: !0,
      progressBar: !0,
      preventDuplicates: !0,
      onclick: null,
      showDuration: "300",
      hideDuration: "1000",
      extendedTimeOut: "1000",
      showEasing: "swing",
      hideEasing: "linear",
      showMethod: "fadeIn",
      hideMethod: "fadeOut",
      tapToDismiss: !1
    })
  }

}

(function ($) {
  "use strict"

  jQuery(window).on('load', function () {
    'use strict';
    setTimeout(function () {
      addModalWallet();
    }, 1000);

  });


})(jQuery);


